package string;

public class Convertor {
    public static void main(String[] args) {
        String str = "123";

//        将字符串转换为基本数据类型
        int i = Integer.parseInt(str);
        System.out.println(i);

        long l = 12345;
//        将基本数据类型转换为字符串
        String s = String.valueOf(l);
        System.out.println("s = " + s);

        char[] arrays = {'a', 'b', 'c', 'd'};
        // 将数组转成字符串
        String s1 = new String(arrays);
        System.out.println("s1 = " + s1);

        String t = "xyz";
        // 将字符串转化为数组
        char[] array = t.toCharArray();
        for (int x = 0; x < array.length; x++) {
            System.out.println(array[x]);
        }

    }
}
